﻿@model QLDV.ViewModels.CSDModel


<script src="@Url.Content("~/Scripts/jquery.json-2.2.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.21.custom.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    


@{
    List<SelectListItem> capQl = (List<SelectListItem>)ViewData["capQL"];
    List<SelectListItem> csdQl = (List<SelectListItem>)ViewData["csdQL"];
}
<script type ="text/javascript">
    jQuery(document).ready(function () {

        $("#loaicsd").change(function () {
            selectBox = $("#csd_ql");
            selectBox.find('option').remove();

            id_loaicsd = $(this).val();
            $.getJSON("/csd/GetListLoaiCsd", { id: id_loaicsd }, function (data) {
                $.each(data, function (index, site) {
                    selectBox.append('<option value =' + site.Value + '>' + site.Text + '</option>');
                });
            });
        });
        $('.date').datepicker({ dateFormat: "mm/dd/yy", maxDate: '+1y', minDate: '+1d' });
    });
</script>

@using (Html.BeginForm("create","csd",FormMethod.Post, new{@id ="frmData"}))
{
    <div class="edit-set" style="width:100%">
       
            <div class= "edit-label">
                @Html.Label("", "Tên")
            </div>
            <div class= "editor-field">
                @Html.EditorFor(m => m.Ten)
                <div class ="error">@Html.ValidationMessageFor(m=>m.Ten)</div>
            </div>

            <div class= "edit-label">
                @Html.Label("","Mô tả")
            </div>
            <div class= "editor-field">
                @Html.TextAreaFor(m => m.MoTa, new { @rows = "5", cols = "40" })
            </div>

            <div class= "edit-label">
                @Html.Label("", "Loại cơ sở đoàn")
            </div>
            <div class= "editor-field">
                @Html.DropDownListFor(m => m.Id_LoaiCSD, capQl, new {id ="loaicsd", style = "width:100%" })
            </div>

            <div class= "edit-label">
                @Html.Label("", "Cơ sở đoàn quản lý")
            </div>
            <div class= "editor-field">
                @Html.DropDownListFor(m => m.Id_CSDQL, csdQl, new { id="csd_ql", style = "width:100%" })
            </div>
            <table>
                <tr>
                    <th>Số quyết định thành lập</th>
                    <th>Ngày thành lập</th>
                </tr>
                <tr>
                    <td>@Html.TextBoxFor(m=>m.SoQDTL)</td>
                    <td>@Html.EditorFor(m => m.NgayThanhLap)</td>
                </tr>
            </table>
            <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
                <div class="ui-dialog-buttonset">
                    <button type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
                        <span class="ui-button-text">Lưu</span>
                    </button>
                </div>
            </div>


    </div>
}